import { GetUserInfo } from '@/api/user'
import copy from 'copy-to-clipboard'
import React from 'react'
import { Button, Cell, Toast } from 'react-vant'
import { useModel, useMutation, useQuery } from 'umi'

export default function Page() {
  const { data } = useQuery(['get/user'], () => GetUserInfo())

  return (
    <>
      <div id="captcha-element"></div>
      <div id="submitButton"></div>

      <section className="min-h-screen bg-gray-50">
        <Cell.Group title="用户数据">
          <Cell title="用户信息（全）">{JSON.stringify(data)}</Cell>
          <Cell title="用户ID">{data?.id}</Cell>
          <Cell title="当前渠道">{sessionStorage.getItem('channel')}</Cell>
        </Cell.Group>

        <Cell.Group title="操作">
          <Cell
            title="删除用户"
            isLink
            onClick={() => {
              localStorage.clear()
              window.location.href = '/'
            }}
          />
        </Cell.Group>
      </section>
    </>
  )
}
